package com.yedean.factory.support;

import com.yedean.factory.config.SingletonRegistry;

import java.util.HashMap;
import java.util.Map;

/**
 * DefaultSingletonRegistry 默认的单例注册
 *
 * @author yedean
 * @date 2022/6/28
 */
public class DefaultSingletonRegistry implements SingletonRegistry {
    
    private final Map<String,Object>  singletonObjects = new HashMap<>();

    @Override
    public Object getSingleton(String name) {
        return singletonObjects.get(name);
    }
    
    
    protected void addSingleton(String name,Object singletonObject){
        singletonObjects.put(name,singletonObject);
    }
}
